@extends('layouts.console_main')
@section('resources')
    @parent
    <style type="text/css">
        #container{ width:90%; height: 500px;}
        tfoot{background:lightblue;}
    </style>
@endsection
@section('content')
    <div class="right_col" role="main">
        <div class="">
            <div class="page-title">
                <div class="title_left">
                    <h2>水表管理  >>  数据详情 </h2>
                </div>
            </div>
            <div class="clearfix"></div>
            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2><a href="/water/get?id={{$id}}">基本信息</a></h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="">
                                    <a href="/water/get?id={{$id}}" class="" data-toggle="" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>

                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
                            <div class="table-responsive">
                                <table id="datatable" class="table table-striped table-bordered">
                                    <tr>
                                        <td>编号</td>
                                        <td>名称</td>
                                        <td>单位名称</td>
                                        <td>区域</td>
                                    </tr>
                                    <tr>
                                        <td>{{$watermeter_info['number']}}</td>
                                        <td>{{$watermeter_info['name']}}</td>
                                        <td>{{$watermeter_info['enterprise_name']}}</td>
                                        <td>{{$watermeter_info['area']}}</td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="clearfix"></div>

                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>用水情况 <small><a href="/data/cancer_hospital/comparsion">比较</a></small></h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Settings 1</a>
                                        </li>
                                        <li><a href="#">Settings 2</a>
                                        </li>
                                    </ul>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
                            <div class="table-responsive">
                                <table id="datatable" class="table table-striped table-bordered">
                                    <thead>
                                    <tr>
                                        <th>时间</th>
                                        <th>使用量</th>
                                        <th>相比昨天变化量</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    @if(count($watermeter_radix_data)>0)
                                        <input type="hidden" name="labels" value="{{json_encode($watermeter_radix_data['labels'])}}">
                                        <input type="hidden" name="consumption_chart_data" value="{{json_encode($watermeter_radix_data['consumption_chart_data'])}}">
                                        <?php $tmp=0;?>
                                        @foreach($watermeter_radix_data['lists'] as $radixList)
                                            <tr>
                                                <td><a href="/water/day/radix/list?id={{$id}}&date={{$radixList['current_date']}}">{{$radixList['current_date']}}</a></td>
                                                <td>{{$radixList['consumption']}}</td>
                                                <td><?php if($tmp == 0 ){ echo 0;} else {echo round($radixList['consumption']-$tmp, 2);} $tmp=$radixList['consumption']; ?></td>
                                            </tr>
                                        @endforeach
                                    @else
                                        <tr><td colspan="4">无</td></tr>
                                    @endif
                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <th>时间</th>
                                        <th>使用量</th>
                                        <th>相比昨天变化量</th>
                                    </tr>
                                    </tfoot>
                                </table>
                            </div>
                            @if(count($watermeter_radix_data)>0)
                                <div class="float:right; ">
                                    <ul class="pagination">
                                        <li><a href="/water/statistic/get?id={{$id}}&page=1&length={{$watermeter_radix_data['length']}}">首页</a></li>
                                        @if($watermeter_radix_data['last_page'] <=5)
                                            @for($i=1; $i<=$watermeter_radix_data['last_page']; $i++)
                                                @if($watermeter_radix_data['page'] == $i)
                                                    <li><a href="/water/statistic/get?id={{$id}}&page={{$i}}&length={{$watermeter_radix_data['length']}}" class="show">{{$i}}</a></li>
                                                @else
                                                    <li><a href="/water/statistic/get?id={{$id}}&page={{$i}}&length={{$watermeter_radix_data['length']}}">{{$i}}</a></li>
                                                @endif
                                            @endfor
                                        @else
                                            @if($watermeter_radix_data['page']>2)
                                                <li><a href="/water/statistic/get?id={{$id}}&page={{$watermeter_radix_data['page']-2}}&length={{$watermeter_radix_data['length']}}">{{$watermeter_radix_data['page']-2}}</a></li>
                                            @endif
                                            @if($watermeter_radix_data['page']>1)
                                                <li><a href="/water/statistic/get?id={{$id}}&page={{$watermeter_radix_data['page']-1}}&length={{$watermeter_radix_data['length']}}">{{$watermeter_radix_data['page']-1}}</a></li>
                                            @endif
                                            <li><a href="/water/statistic/get?id={{$id}}&page={{$watermeter_radix_data['page']}}&length={{$watermeter_radix_data['length']}}" class="show">{{$watermeter_radix_data['page']}}</a></li>
                                            @if(($watermeter_radix_data['page']+5)<$watermeter_radix_data['last_page'])
                                                <li><a href="/water/statistic/get?id={{$id}}&page={{$watermeter_radix_data['page']+1}}&length={{$watermeter_radix_data['length']}}">{{$watermeter_radix_data['page']+1}}</a></li>
                                                <li><a href="/water/statistic/get?id={{$id}}&page={{$watermeter_radix_data['page']+2}}&length={{$watermeter_radix_data['length']}}">{{$watermeter_radix_data['page']+2}}</a></li>
                                                <li><a href="/water/statistic/get?id={{$id}}&page={{$watermeter_radix_data['page']+3}}&length={{$watermeter_radix_data['length']}}">{{$watermeter_radix_data['page']+3}}</a></li>
                                                <li><a href="/water/statistic/get?id={{$id}}&page={{$watermeter_radix_data['page']+4}}&length={{$watermeter_radix_data['length']}}">{{$watermeter_radix_data['page']+4}}</a></li>
                                                <li><a href="">....</a></li>
                                                <li><a href="/water/statistic/get?id={{$id}}&page={{$watermeter_radix_data['last_page']}}&length={{$watermeter_radix_data['length']}}">{{$watermeter_radix_data['last_page']}}</a></li>
                                            @else
                                                @for($i=1; $i<=5;$i++)
                                                    @if($watermeter_radix_data['page']+$i<=$watermeter_radix_data['last_page'])
                                                        <li><a href="/water/statistic/get?id={{$id}}&page={{$watermeter_radix_data['page']+$i}}&length={{$watermeter_radix_data['length']}}">{{$watermeter_radix_data['page']+$i}}</a></li>
                                                    @endif
                                                @endfor
                                            @endif
                                        @endif
                                        <li><a a href="/water/statistic/get?id={{$id}}&page={{$watermeter_radix_data['last_page']}}&length={{$watermeter_radix_data['length']}}">末页</a></li>
                                    </ul>
                                </div>
                            @endif
                        </div>
                    </div>
                </div>

                <div class="clearfix"></div>

                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>曲线图<small>2018-03-27</small></h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Settings 1</a>
                                        </li>
                                        <li><a href="#">Settings 2</a>
                                        </li>
                                    </ul>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
                            <canvas id="lineChart"></canvas>
                        </div>
                    </div>
                </div>

                <div class="clearfix"></div>

                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>曲线图 <small style="background-color:#26B99A; width: 20px">□</small><small>表示  <?php echo date('Y-m-d', strtotime('-6days')). "--".date('Y-m-d')?></small>
                                <small style="background-color: #03586A">□</small><small>表示  <?php echo date('Y-m-d', strtotime('-13days')). "--".date('Y-m-d', strtotime("-7days"))?></small></h2>
                            <input type="hidden" name="water_meter_id" value="{{$id}}">
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Settings 1</a>
                                        </li>
                                        <li><a href="#">Settings 2</a>
                                        </li>
                                    </ul>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
                            <canvas id="mybarChart"></canvas>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /page content -->
@endsection
@section('scriptResources')
    @parent
    <script>

    </script>
@endsection

